<style xmlns:th="http://www.w3.org/1999/xhtml" >
.pdding7{padding-top: 7px;margin-top: 7px;}
</style>
					<form xmlns:th="http://www.w3.org/1999/xhtml" id="form_shop_add_1" enctype="multipart/form-data"  method="post" action="shop/add" class="form-horizontal bv-form" >
							<div class="form-body">
								<input  type="hidden" name="merchantId" th:value="${merchantId}"/>
								<input  type="hidden" name="parUid" th:value="${parUid}"/>
								<div class="form-group" >
									<label  class="col-md-3 control-label">店名:
									</label>
									<div class="col-md-9">
										<input class='form-control ' type="text" placeholder="" name='shopName'  data-bv-notempty='true' data-bv-notempty-message='此处不能为空！' value=""  />
									</div>
								</div>

								<div class="form-group" >
									<label  class="col-md-3 control-label">状态:
									</label>
									<div class="col-md-9">
										<select name="status">
											<option value="1">--启用--</option>
											<option value="0">--禁用--</option>
										</select>
									</div>
								</div>

								<div class="form-group">
									<label  class="col-md-3 control-label">省份:
									</label>
									<div class="col-md-9 left ">
										<select name="provinceRegionId" id="regionProvince1">
											<option value="0">--请选择省份--</option>
											<option th:each="pro:${provinces}"  th:value="${pro.regionId}" th:text="'--'+${pro.regionName}+'--'"></option>
										</select>
									</div>
								</div>

								<div class="form-group">
									<label  class="col-md-3 control-label">城市:
									</label>
									<div class="col-md-9 left ">
										<select name="cityRegionId" id="regionCity1">
											<option value="0">--请选择城市--</option>
										</select>
									</div>
								</div>

								<div class="form-group" >
									<label  class="col-md-3 control-label">联系地址:
									</label>
									<div class="col-md-9">
										<input class='form-control ' type="text"  name='shopAddress' placeholder=""  data-bv-notempty='true' data-bv-notempty-message='此处不能为空！' value=""  />
									</div>
								</div>

								<div class="form-group" >
									<label  class="col-md-3 control-label">门店电话:
									</label>
									<div class="col-md-9">
										<input class='form-control ' type="text"  name='shopPhone' placeholder="手机号码或固定电话号码（固定号码格式为xxx-xxxxxxxx）"  data-bv-notempty='true' data-bv-notempty-message='此处不能为空！' value=""  />
									</div>
								</div>

								<div class="form-group" id="shopPic">
									<label  class="col-md-3 control-label">门店图片:
									</label>
									<div class="col-md-9">
										<input id="shopFile" class='form-control ' name='test' type="file"/>
									</div>
								</div>
								<input id="shopFile1" class='form-control ' type="hidden"  name='shopPic' />
								<div class="form-group">
									<label  class="col-md-3 control-label"></label>
									<div class="col-md-9">
										<img id="imgShow" src="" style="display: block;height: 150px;"/>
									</div>
								</div>
							</div>
							<div class="  form-group ">
								<div class="pull-right form-btn">
									<button class="btn btn-warning" type="reset"><i class="ace-icon fa fa-undo bigger-110"></i> 重置	</button>
									<button type="submit" class="btn btn-info"><i class="ace-icon fa fa-check bigger-110"></i>确认</button>
								</div>
							</div>
							</form>
<script type="text/javascript">

//^[0-9a-zA-Z]+[0-9a-zA-Z\.-]*\.[a-zA-Z]{2,4}$

jQuery(document).ready(function() {
	
	FormSamples.init({
		formId:'form_shop_add_1'
	});

	$("#regionProvince1").change(function(){
		var pid = $(this).val();
		$.post("region/cities",{parentId:pid},function(result){
			console.log(result);
			console.log(typeof result);
			var arr = result;
			var len = arr.length;
			var obj = document.getElementById("regionCity1");
			obj.innerHTML="";
			// if(len>1){
			// 	var nullOp = document.createElement("option");
			// 	nullOp.setAttribute("value","");
			// 	nullOp.appendChild(document.createTextNode("--市--"));
			// 	obj.appendChild(nullOp);
			// }
			$.each(arr, function(index, json){
				//alert(json.channelName);
				var nullOp = document.createElement("option");
				nullOp.setAttribute("value",json.regionId);
				nullOp.appendChild(document.createTextNode(json.regionName));
				obj.appendChild(nullOp);
			});
		});
	});

	/**
	 * 选择文件后直接上传，返回图片访问路径
	 */
	$("#shopPic").change(function(){
		var formdata = new FormData();
		formdata.append("image",$("#shopFile")[0].files[0]);
		$.ajax({
			url: "upload/image",
			type:"post",
			data:formdata,
			processData: false,
			contentType: false,
			success:function (doc) {
				$("#shopFile1").val(doc.data);
				$("#imgShow").attr("src",doc.data);
			}
		})
	});

});
</script>